/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-07-07 15:25:33
 * @LastEditTime : 2023-07-07 15:26:49
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\FirstLevel\ProjectOperationPaymentItem.jsx
 * @Description  :
 */
import { API_LIST } from '../../../Api/Api'
import { commonTableList, BuiltInData } from '../Common/common'
import { AddDataButton, ModDataButton, DelDataButton } from '../Common/options'

export const ProjectOperationPaymentItem = async ({ url, OptionsEvent, ClientData, Permission }) => {
    let data = {
        pageSize: 1000,
        params: { pageIndex: 1, OrderField: 'code@asc' },
        get: API_LIST()[`get${url}`],
        added: `pos${url}`,
        modify: `put${url}`,
        delete: `del${url}`,
        options: [
            Permission.findIndex(v => v.uuid === 'bc26d777-342d-46ff-acc9-bfed2c4a3e7d') !== -1 && (
                <AddDataButton OptionsEvent={OptionsEvent} type="primary" icon="add" title="新增" />
            ),
        ],
        columns: [
            commonTableList.uuid,
            { ...commonTableList.tableName },
            { ...commonTableList.code, hideInSearch: true },
            {
                dataIndex: 'projectOperationPaymentType',
                title: '资金支出类型',
                valueType: 'select',
                valueEnum: BuiltInData.projectOperationPaymentType,
                hideInSearch: true,
                rules: true,
                width: 200,
            },
            commonTableList.createUserName,
            commonTableList.createTime,
            commonTableList.updateUserName,
            commonTableList.updateTime,
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 200,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        Permission.findIndex(v => v.uuid === '345f1c50-0d9a-452a-ac80-8c33131df527') !== -1 && (
                            <ModDataButton OptionsEvent={OptionsEvent} key="modify" title="修改" data={record} />
                        ),
                        Permission.findIndex(v => v.uuid === '30e7eae6-2066-4005-84b8-26777d8048a2') !== -1 && (
                            <DelDataButton
                                OptionsEvent={OptionsEvent}
                                key="del"
                                title="删除"
                                url={url}
                                uuid={record.uuid}
                            />
                        ),
                    ]
                },
            },
        ],
    }
    return data
}
